package com.chwn.curiousdiary.ui.user.activity;

import android.os.Bundle;
import android.view.View;

import com.chwn.curiousdiary.R;
import com.chwn.curiousdiary.gloable.Constant;
import com.chwn.curiousdiary.ui.BaseShareActivity;
import com.chwn.curiousdiary.ui.user.fragment.CollectionFragment;
import com.gyf.barlibrary.ImmersionBar;

/**
 * Created by Myshikin on 2017/4/25.
 * 历史记录/我的收藏
 */
public class CollectionActivity extends BaseShareActivity {

    private boolean isHistoryPage;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_collection;
    }

    @Override
    protected void initData() {
        super.initData();
        isHistoryPage = getIntent().getBooleanExtra(Constant.IS_HISTORY_PAGE, false);
    }

    @Override
    protected void initView() {
        setTitleText(isHistoryPage ? "历史记录" :"我的收藏");
        initnavigationBarColor(-1);
        findViewById(R.id.ib_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        CollectionFragment collectionFragment = new CollectionFragment();

        Bundle args = new Bundle();
        args.putBoolean(Constant.IS_HISTORY_PAGE , isHistoryPage);
        collectionFragment.setArguments(args);
        collectionFragment.setLoadDataNow(true);
        getSupportFragmentManager()
                .beginTransaction()
                .replace(R.id.fl_content, collectionFragment)
                .commit();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImmersionBar.with(this).destroy();
    }


    @Override
    protected View getLocationView() {
        return findViewById(R.id.fl_content);
    }
}
